package org.jeecg.modules.sggg.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.sggg.entity.SgBlutdruckRecord;
import org.jeecg.modules.sggg.entity.SgMember;
import org.jeecg.modules.sggg.entity.SgRemindRecord;
import org.jeecg.modules.sggg.mapper.SgBlutdruckRecordMapper;
import org.jeecg.modules.sggg.service.ISgBlutdruckRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @Description: 血压记录表
 * @Author: jeecg-boot
 * @Date: 2022-10-17
 * @Version: V1.0
 */
@Service
public class SgBlutdruckRecordServiceImpl extends ServiceImpl<SgBlutdruckRecordMapper, SgBlutdruckRecord> implements ISgBlutdruckRecordService {


    @Autowired
    private SgBlutdruckRecordMapper sgBlutdruckRecordMapper;

    @Override
    public IPage<SgBlutdruckRecord> queryList(Page<SgBlutdruckRecord> page, String OrgCode,
                                              SgBlutdruckRecord sgBlutdruckRecord, String roleCode, String userId) {
        return sgBlutdruckRecordMapper.queryList(page, OrgCode, sgBlutdruckRecord.getMemberId(), sgBlutdruckRecord.getMemberName(), sgBlutdruckRecord.getMemberPhone(),
                sgBlutdruckRecord.getResponsibleAgencies(),sgBlutdruckRecord.getIntervene(), roleCode, userId);
    }

    @Override
    public IPage<SgMember> queryPageListBySql(Page<SgMember> page, String sysOrgCode, List<String> responsibleAgencies,Integer day, String roleCode, String userId,String name, String phone,boolean Bindstatus,int deviceType) {
        List<SgMember> cronJobLists = sgBlutdruckRecordMapper.queryPageListBySql(page, sysOrgCode,responsibleAgencies, day, roleCode, userId,name,phone,Bindstatus,deviceType);
        return page.setRecords(cronJobLists);
    }

    @Override
    public SgBlutdruckRecord getAverageRecord(String memberId, Integer level) {
        return sgBlutdruckRecordMapper.getAverageRecord(memberId, level);
    }

    @Override
    public int getBlutdruckStatistics(String memberId, Integer level) {
        return sgBlutdruckRecordMapper.getBlutdruckStatistics(memberId, level);
    }

    @Override
    public SgBlutdruckRecord getBlutdruckStatisticsByDate(String memberId, String dateStartTime, String dateEndTime) {
        return sgBlutdruckRecordMapper.getBlutdruckStatisticsByDate(memberId, dateStartTime, dateEndTime);
    }

    @Override
    public List<Map<String, Object>> interventionWarning(String orgCode) {
        return sgBlutdruckRecordMapper.interventionWarning(orgCode);
    }

    @Override
    public List<Map<String, Object>> threeHighNumber(String orgCode) {
        return sgBlutdruckRecordMapper.threeHighNumber(orgCode);
    }

    @Override
    public IPage<SgBlutdruckRecord> queryListByDoctor(Page<SgBlutdruckRecord> page, String name, String phone, String sysOrgCode, List<String> responsibleAgencies, String roleCode, String doctorId, String intervene) {
        return baseMapper.queryListByDoctor(page, name, phone,sysOrgCode,roleCode,responsibleAgencies, doctorId, intervene);
    }

    @Override
    public List<SgBlutdruckRecord> dayMeasureNumberCount(String sysOrgCode, String roleCode, String date, String doctorId, String intervene,List<String> responsibleAgencies) {
        return baseMapper.dayMeasureNumberCount(sysOrgCode, roleCode, date, doctorId, intervene,responsibleAgencies);
    }

    public List<SgBlutdruckRecord> dayMeasureNumberCountTwo(String sysOrgCode, String roleCode, String date, String doctorId, String intervene,List<String> responsibleAgencies) {
        return baseMapper.dayMeasureNumberCountTwo(sysOrgCode, roleCode, date, doctorId, intervene,responsibleAgencies);
    }

    @Override
    public List<SgBlutdruckRecord> queryaddressCount() {
        return sgBlutdruckRecordMapper.queryaddressCount();
    }

    @Override
    public Integer getYearSgCount(Integer yearDate) {
        return sgBlutdruckRecordMapper.getYearSgCount(yearDate);
    }

    @Override
    public Integer getMonthSgCount(Integer yearDate) {
        return sgBlutdruckRecordMapper.getMonthSgCount(yearDate);
    }

    @Override
    public List<SgBlutdruckRecord> getMonthControlRate(Integer yearDate) {
        return sgBlutdruckRecordMapper.getMonthControlRate(yearDate);
    }

    @Override
    public List<SgBlutdruckRecord> getXyMonthControlRate(Integer yearDate) {
        return sgBlutdruckRecordMapper.getXyMonthControlRate(yearDate);
    }

    @Override
    public List<Map<String, Integer>> getEachLevelNum(String orgCode) {
        return sgBlutdruckRecordMapper.getEachLevelNum(orgCode);
    }
}
